import request from '@/utils/request';

export default {
	// 用户登录
	login(data) {
		return request({
			url: '/lgwx',
			method: 'POST',
			data,
			header: {
				noToken: true
			}
		});
	},
	// 绑定手机
	bindMobile(data) {
		return request({
			url: '/user/bindMobile',
			method: 'POST',
			data
		});
	},
	// 用户信息
	myInfo() {
		return request({
			url: '/user/myInfo',
			method: 'GET'
		});
	},
	// 用户信息修改
	myInfoUpdate(data) {
	    return request({
			url: '/user/updInfo',
			method: 'POST',
			data
		});
	},
	// 上传图片
	uploadImg(data) {
		return request({
			url: '/upwx',
			method: 'POST',
			data
		});
	},
	// 培训机构-列表
	organInfoLst(data) {
		return request({
			url: '/organ/info/list',
			method: 'POST',
			data
		});
	},
	// 培训机构-详情
	organInfoDetail(data) {
		return request({
			url: `/organ/info/detail?organId=${data.organId}`,
			method: 'GET'
		});
	},
	// 培训课程-列表
	organCourseLst(data) {
		return request({
			url: '/organ/course/list',
			method: 'POST',
			data
		});
	},
	//培训课程-详情
	organCourseDetail(data) {
		return request({
			url: `/organ/course/detail?courseId=${data.courseId}`,
			method: 'GET',
		})
	},
	// 文章-列表
	articleList(data) {
		return request({
			url: '/cms/articles',
			method: 'POST',
			data
		});
	},
	// 文章-详情
	articleDetail(data) {
		return request({
			url: `/cms/articleDetail?articleId=${data.articleId}`,
			method: 'GET',
		})
	},
	// 订单-列表
	orderInfoList(data) {
		return request({
			url: '/order/info/list',
			method: 'POST',
			data
		})
	},
	// 订单-详情
	orderInfoDetail(data) {
		return request({
			url: `/order/info/detail?orderId=${data.orderId}`,
			method: 'GET',
			data
		})
	},
	// 订单-下单
	orderInfoAdd(data) {
		return request({
			url: '/order/info/add',
			method: 'POST',
			data
		})
	},
	// 订单-取消
	orderInfoClose(data) {
		return request({
			url: '/order/info/close',
			method: 'POST',
			data
		})
	},
	// 证书列表
	certificateInfoList(data) {
		return request({
			url: '/certificate/info/list',
			method: 'POST',
			data
		})
	},
	// 证书-添加
	certificateInfoAdd(data) {
		return request({
			url: '/certificate/info/add',
			method: 'POST',
			data
		})
	},
	// 证书详情
	certificateInfoDetail(data) {
		return request({
			url: `/certificate/info/detail?certificateId=${data.certificateId}`,
			method: 'GET'
		})
	},
	// 微信支付
	orderPayWXPay(data) {
		return request({
			url: '/order/pay/wxpay',
			method: 'POST',
			data
		})
	},

	// 申请成为教员
	applyTeacher(data) {
		return request({
			url: '/teacher/upd',
			method: 'POST',
			data
		})
	},
	// 获取分享code(用于绑定支付的订单)
	getShareLink(data) {
		return request({
			url: '/teacher/share/link',
			method: 'POST',
			data
		})
	},
	// 绑定分享的教练code
	bindShareLink(data) {
		return request({
			url: '/order/info/addShare',
			method: 'POST',
			data
		})
	},
	// 教练佣金
	commissionDetail(data) {
		return request({
			url: '/teacher/commission/detail',
			method: 'GET'
		})
	},
	// 提款列表
	withdrawOrderList(data) {
		return request({
			url: '/withdraw/order/list',
			method: 'POST',
			data
		})
	},
	// 提款申请
	withdrawOrderAdd(data) {
		return request({
			url: '/withdraw/order/add',
			method: 'POST',
			data
		})
	},
	// 提款详情
	withdrawOrderDetail(data) {
		return request({
			url: `/withdraw/order/detail?orderId=${data.orderId}`,
			method: 'GET'
		})
	},
	// 获取省份
	districtFirst() {
		return request({
			url: '/dict/district/first',
			method: 'GET'
		})
	},
	// 根据省份获取城市
	districtChild(data) {
		return request({
			url: `/dict/district/child?parentId=${data.parentId}`,
			method: 'GET'
		})
	},

};